package com.pk.android.view;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

import com.pk.android.R;
import com.pk.android.dummy.temp_source;
import com.pk.android.model.BaseFragment;
import com.pk.android.view.adapter.LeagueTeamsAdapter;

public class MyTeamsFragment extends BaseFragment {
 
	public static final String EXTRA_TITLE = "EXTRA_TITLE";
	
	LeagueTeamsAdapter teamsAdapter;
	Button btnAllLeagues;

	public static final MyTeamsFragment newInstance(String title)
	{
		MyTeamsFragment f = new MyTeamsFragment();
		Bundle bdl = new Bundle(1);
	   bdl.putString(EXTRA_TITLE, title);
	   f.setArguments(bdl);

		return f;
	}
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
    	super.onCreateView(inflater, container, savedInstanceState);
    	
        view = inflater.inflate(R.layout.fragment_pk_my_leagues, container, false);
                
    	((TextView)view.findViewById(R.id.txt_league_name)).setText(title); 
    	
        return view;
    }

	@Override
	public void onCreate(Bundle savedInstanceState) {
		// initialize essential components of the fragment that you want to retain when the fragment is paused or stopped, then resumed.
		super.onCreate(savedInstanceState);
	}


	@Override
	public void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);

		ListView listViewTeams = (ListView)view.findViewById(R.id.team_list);
		teamsAdapter = new LeagueTeamsAdapter(getActivity(), temp_source.getMyTeamList());
		listViewTeams.setAdapter(teamsAdapter);
	}
	
}
